Ext.define('AmpleHarvest.objects.search.querypanel.QueryPanel', 
{
   extend: 'Ext.panel.Panel',
   alias: 'widget.ampleharvest-objects-search-panel-querypanel',
   
   requires: 
   [
      'AmpleHarvest.objects.search.querypanel.form.AbstractSearchForm',
      'AmpleHarvest.objects.querymanager.cQueryManager'
   ],

   title: "Search Manager",
   collapseDirection  : "left",
   collapsible        : true,
   layout: {
        //type: 'accordion',
        //multi: true,
        type: 'border',
        titleCollapse: false,
        animate: false,
        shrinkToFit: false
    },
    autoScroll: false,
   m_str_SourceGUID  : "",
   
   initComponent: function() {
   	
   	this.m_obj_Search = Ext.create(
            "AmpleHarvest.objects.search.querypanel.form.AbstractSearchForm",
            {
            	title: 'Search',
               m_str_SourceGUID  : this.m_str_SourceGUID,
               width : '100%',
               flex: 1,
               region: 'center',
               split: true
            }
      );
      
      this.m_obj_SavedQueryPanel = Ext.create("AmpleHarvest.objects.querymanager.cQueryManager",
            {
               title: 'Saved Searches',
               m_str_view_type      : 'mini',
               m_str_SourceGUID  : this.m_str_SourceGUID,
               //width : '100%'
               region: 'south',
               flex: 1,
               maxHeight: 300,
               split: true
               
            }
      );
      
      this.items = [ this.m_obj_Search, this.m_obj_SavedQueryPanel ];
      this.callParent();
      
      this.m_obj_SavedQueryPanel.store.load();
   }
   
});